﻿using System.Collections.Generic;
using VideoSeller.Business.Data;
using VideoSeller.Business.Data.Enums;
using System.Linq;
namespace VideoSeller.Web.Models
{
	public class ContentListFilterViewModel : BaseViewModel
	{
		public string Controller { get; set; }

		public string Action { get; set; }

		public FilterViewModel Filter { get; set; }

		public PriceFilter PriceFilter { get; set; }

		public VideoContentType? VideoTypeFilter { get; set; }

		public ContentListFilterType CurrentFilter { get; set; }

		public IEnumerable<Category> Categories { get; set; }

		public IEnumerable<Category> SelectedCategories { get; set; }

		public IEnumerable<string> SelectedLanguages { get; set; }

		public bool HideFilterControls { get; set; }

		public int PageNumber { get; set; }

		public int PageCount { get; set; }

		public int PageSize { get; set; }

		public int Total { get; set; }

		public bool ShowMarkedFilter { get; set; }
        public int? SelectedCountry { get; set; }
        public string SelectedCountryName
        {
            get{
                if (SelectedCountry == null)
                    return string.Empty;
                else
                    return countryes.Where(m => m.Id == SelectedCountry.Value).FirstOrDefault().Name;
            }
        }
        public IEnumerable<Country> countryes { get; set; }
		public bool HasSelected
		{
			get { return Filter != null && Filter.HasSelected; }
		}

		public ContentListFilterViewModel()
		{
			Controller = "Home";
			CurrentFilter = ContentListFilterType.All;
			SelectedCategories = new List<Category>();
			SelectedLanguages = new List<string>();
            SelectedCountry = null;
			PriceFilter = PriceFilter.All;
            SelectedCountry = null;
		}
	}
}